//2009/08/13 19:40:58
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class ImageDithering
{
public:
    int count(string dithered, vector <string> screen)
    {
		int num = 0;
		for(int i=0; i<screen.size(); i++)
		{
			for(int j=0; j<screen[i].size(); j++)
			{
				if(dithered.find(screen[i][j]) != string::npos)
				{
					num ++;
				}
			}
		}
		return num;
    }
};
